package TEST;

import java.lang.annotation.Annotation;

public class MyAnnotation {
    //获取MyAnnotation类的getObjectInfo()方法的所有注解
    Annotation[] arr;
    {
        try {
            arr = Class.forName("TEST.MyAnnotation").getMethod("getObjectInfo").getAnnotations();
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        //遍历所有注解
        for (Annotation annotation : arr) {
            System.out.println(annotation);
        }
    }
}
